<template>
	<view>
		<view class="form-box">
			<view class="form-row">
				<text style="letter-spacing: 10rpx;">旧密码</text>
				<input password v-model="oldpassword" placeholder="请输入旧密码" />
			</view>
			<view class="form-row">
				<text style="letter-spacing: 10rpx;">新密码</text>
				<input password v-model="newpassword" placeholder="请输入新密码" />
			</view>
			<view class="form-row">
				<text>重复密码</text>
				<input password v-model="repassword" placeholder="请重复一次密码" />
			</view>
		</view>
		
		<view style="height: 60rpx;"></view>
		<view class="button-box">
			<view class="login-btn" @click="doPassword()">确认修改</view>
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				oldpassword:'',
				newpassword:'',
				repassword:""
			}
		},
		methods: {
			doPassword(){
				uni.showLoading({
					title:"正在提交"
				});
				this.request.post({
					url:"index.php/index/member/password",
					data:{
						oldpassword:this.oldpassword,
						newpassword:this.newpassword,
						repassword:this.repassword
					},
					success:(res)=>{
						uni.hideLoading();
						if(res.statusCode != 200){
							uni.showToast({
								icon:"none",
								title:"请求错误，请稍候再试"
							});
							return;
						}
						if(res.data.code == 1){
							uni.showModal({
								showCancel:false,
								title:"提示",
								content:"密码修改成功",
								success() {
									uni.navigateBack({
										delta:1
									})
								}
							})
						}else{
							uni.showToast({
								icon:"none",
								title:res.data.msg
							});
						}
					},
					fail:()=>{
						uni.hideLoading();
					}
				})
			}
		}
	}
</script>

<style>
.form-box{
	padding: 40rpx;
}
.form-box .form-row{
	display: flex;
	padding: 20rpx 0rpx;
	font-size: 30rpx;
	color: #333333;
	align-items: center;
	justify-content: center;
}
.form-box .form-row input{
	margin-left: 20rpx;
	background: #f6f6f6;
	border-radius: 60rpx;
	padding: 10rpx 40rpx;
}
.button-box{
  padding: 20rpx 0px;
  display: flex;
  justify-content: center;
}
.login-btn{
	background: url(../../static/pink_btn2.png);
	background-size: cover;
	width: 562rpx;
	height: 90rpx;
	text-align: center;
	line-height: 90rpx;
	color: #FFFFFF;
	border: none !important;
}
</style>
